import neko.Lib;
import nGui.Manager;
import nGui.controls.List;
import nGui.controls.Label;
import nGui.controls.Button;
import nGui.controls.Control;
import nGui.controls.containers.VBox;
import nGui.controls.containers.HBox;
import nGui.controls.containers.Dialog;

class ListSample
{
	var t : Int;
	public static function main()
	{
		var a = new ListSample();
	}
	
	public function new()
	{
		var mng : Manager = new Manager();
		
		var vert : VBox = new VBox();
		var horz : HBox = new HBox();
		var lbl : Label = new Label( "No items selected" );
		var lst : nGui.controls.List = new nGui.controls.List();
		var lst2 : nGui.controls.List = new nGui.controls.List();
		var lst3 : nGui.controls.List = new nGui.controls.List();
		var lst4 : nGui.controls.List = new nGui.controls.List();
		var lst5 : nGui.controls.List = new nGui.controls.List();
		for ( i in 0...10 )
		{
			lst.appendItem( "item " + ( i + 1 ) );
			lst2.appendItem( "item " + ( i + 1 ) );
			lst3.appendItem( "item " + ( i + 1 ) );
			lst4.appendItem( "item " + ( i + 1 ) );
			lst5.appendItem( "item " + ( i + 1 ) );
		}
		vert.appendChild( lbl );
		vert.appendChild( horz );
		horz.appendChild( lst );
		horz.appendChild( lst2 );
		horz.appendChild( lst3 );
		horz.appendChild( lst4 );
		horz.appendChild( lst5 );
		
		lst2.multiple = true;
		lst3.editbox = true;
		lst4.dropdown = true;
		lst5.dropdown = true;
		lst5.editbox = true;
		
		lst.onChange = function()
		{
			lbl.text = Std.string( lst.selectedItems );
		}
		lst2.onChange = function()
		{
			lbl.text = Std.string( lst2.selectedItems );
		}
		lst3.onChange = function()
		{
			lbl.text = Std.string( lst3.selectedItems );
		}
		lst4.onChange = function()
		{
			lbl.text = Std.string( lst4.selectedItems );
		}
		lst5.onChange = function()
		{
			lbl.text = Std.string( lst5.selectedItems );
		}
		
		var wind : Dialog = new Dialog( vert );
		wind.title = "List Sample";
		wind.show();
		mng.loop();
	}
}